<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>entry manual page - Tk Built-In Commands</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk Commands</a> <small>&gt;</small> entry</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="entry.htm#M2" NAME="L508">NAME</A>
<DL><DD>entry &mdash; Create and manipulate 'entry' one-line text entry widgets</DD></DL>
<DD><A HREF="entry.htm#M3" NAME="L509">SYNOPSIS</A>
<DL>
</DL>
<DD><A HREF="entry.htm#M4" NAME="L510">STANDARD OPTIONS</A>
<DL>
<DD><A HREF="options.htm#M-background">-background or -bg, background, Background</A>
<DD><A HREF="options.htm#M-borderwidth">-borderwidth or -bd, borderWidth, BorderWidth</A>
<DD><A HREF="options.htm#M-cursor">-cursor, cursor, Cursor</A>
<DD><A HREF="options.htm#M-exportselection">-exportselection, exportSelection, ExportSelection</A>
<DD><A HREF="options.htm#M-font">-font, font, Font</A>
<DD><A HREF="options.htm#M-foreground">-foreground or -fg, foreground, Foreground</A>
<DD><A HREF="options.htm#M-highlightbackground">-highlightbackground, highlightBackground, HighlightBackground</A>
<DD><A HREF="options.htm#M-highlightcolor">-highlightcolor, highlightColor, HighlightColor</A>
<DD><A HREF="options.htm#M-highlightthickness">-highlightthickness, highlightThickness, HighlightThickness</A>
<DD><A HREF="options.htm#M-insertbackground">-insertbackground, insertBackground, Foreground</A>
<DD><A HREF="options.htm#M-insertborderwidth">-insertborderwidth, insertBorderWidth, BorderWidth</A>
<DD><A HREF="options.htm#M-insertofftime">-insertofftime, insertOffTime, OffTime</A>
<DD><A HREF="options.htm#M-insertontime">-insertontime, insertOnTime, OnTime</A>
<DD><A HREF="options.htm#M-insertwidth">-insertwidth, insertWidth, InsertWidth</A>
<DD><A HREF="options.htm#M-justify">-justify, justify, Justify</A>
<DD><A HREF="options.htm#M-relief">-relief, relief, Relief</A>
<DD><A HREF="options.htm#M-selectbackground">-selectbackground, selectBackground, Foreground</A>
<DD><A HREF="options.htm#M-selectborderwidth">-selectborderwidth, selectBorderWidth, BorderWidth</A>
<DD><A HREF="options.htm#M-selectforeground">-selectforeground, selectForeground, Background</A>
<DD><A HREF="options.htm#M-takefocus">-takefocus, takeFocus, TakeFocus</A>
<DD><A HREF="options.htm#M-textvariable">-textvariable, textVariable, Variable</A>
<DD><A HREF="options.htm#M-xscrollcommand">-xscrollcommand, xScrollCommand, ScrollCommand</A>
</DL>
<DD><A HREF="entry.htm#M5" NAME="L511">WIDGET-SPECIFIC OPTIONS</A>
<DL>
<DD><A HREF="entry.htm#M6" NAME="L512">-disabledbackground, disabledBackground, DisabledBackground</A>
<DD><A HREF="entry.htm#M7" NAME="L513">-disabledforeground, disabledForeground, DisabledForeground</A>
<DD><A HREF="entry.htm#M8" NAME="L514">-invalidcommand or -invcmd, invalidCommand, InvalidCommand</A>
<DD><A HREF="entry.htm#M9" NAME="L515">-readonlybackground, readonlyBackground, ReadonlyBackground</A>
<DD><A HREF="entry.htm#M10" NAME="L516">-show, show, Show</A>
<DD><A HREF="entry.htm#M11" NAME="L517">-state, state, State</A>
<DD><A HREF="entry.htm#M12" NAME="L518">-validate, validate, Validate</A>
<DD><A HREF="entry.htm#M13" NAME="L519">-validatecommand or -vcmd, validateCommand, ValidateCommand</A>
<DD><A HREF="entry.htm#M14" NAME="L520">-width, width, Width</A>
</DL>
<DD><A HREF="entry.htm#M15" NAME="L521">DESCRIPTION</A>
<DD><A HREF="entry.htm#M16" NAME="L522">VALIDATION</A>
<DL class="validation">
<DD><A HREF="entry.htm#M17" NAME="L523"><B>none</B></A>
<DD><A HREF="entry.htm#M18" NAME="L524"><B>focus</B></A>
<DD><A HREF="entry.htm#M19" NAME="L525"><B>focusin</B></A>
<DD><A HREF="entry.htm#M20" NAME="L526"><B>focusout</B></A>
<DD><A HREF="entry.htm#M21" NAME="L527"><B>key</B></A>
<DD><A HREF="entry.htm#M22" NAME="L528"><B>all</B></A>
</DL>
<DL class="validation">
<DD><A HREF="entry.htm#M23" NAME="L529"><B>%d</B></A>
<DD><A HREF="entry.htm#M24" NAME="L530"><B>%i</B></A>
<DD><A HREF="entry.htm#M25" NAME="L531"><B>%P</B></A>
<DD><A HREF="entry.htm#M26" NAME="L532"><B>%s</B></A>
<DD><A HREF="entry.htm#M27" NAME="L533"><B>%S</B></A>
<DD><A HREF="entry.htm#M28" NAME="L534"><B>%v</B></A>
<DD><A HREF="entry.htm#M29" NAME="L535"><B>%V</B></A>
<DD><A HREF="entry.htm#M30" NAME="L536"><B>%W</B></A>
</DL>
<DD><A HREF="entry.htm#M31" NAME="L537">WIDGET COMMAND</A>
<DD><A HREF="entry.htm#M32" NAME="L538">INDICES</A>
<DL class="indices">
<DD><A HREF="entry.htm#M33" NAME="L539"><I>number</I></A>
<DD><A HREF="entry.htm#M34" NAME="L540"><B>anchor</B></A>
<DD><A HREF="entry.htm#M35" NAME="L541"><B>end</B></A>
<DD><A HREF="entry.htm#M36" NAME="L542"><B>insert</B></A>
<DD><A HREF="entry.htm#M37" NAME="L543"><B>sel.first</B></A>
<DD><A HREF="entry.htm#M38" NAME="L544"><B>sel.last</B></A>
<DD><A HREF="entry.htm#M39" NAME="L545"><B>@</B><I>number</I></A>
</DL>
<DD><A HREF="entry.htm#M40" NAME="L546">SUBCOMMANDS</A>
<DL class="subcommands">
<DD><A HREF="entry.htm#M41" NAME="L547"><I>pathName </I><B>bbox </B><I>index</I></A>
<DD><A HREF="entry.htm#M42" NAME="L548"><I>pathName </I><B>cget</B> <I>option</I></A>
<DD><A HREF="entry.htm#M43" NAME="L549"><I>pathName </I><B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>?</A>
<DD><A HREF="entry.htm#M44" NAME="L550"><I>pathName </I><B>delete </B><I>first </I>?<I>last</I>?</A>
<DD><A HREF="entry.htm#M45" NAME="L551"><I>pathName </I><B>get</B></A>
<DD><A HREF="entry.htm#M46" NAME="L552"><I>pathName </I><B>icursor </B><I>index</I></A>
<DD><A HREF="entry.htm#M47" NAME="L553"><I>pathName </I><B>index</B><I> index</I></A>
<DD><A HREF="entry.htm#M48" NAME="L554"><I>pathName </I><B>insert </B><I>index string</I></A>
<DD><A HREF="entry.htm#M49" NAME="L555"><I>pathName </I><B>scan</B> <I>option args</I></A>
<DL class="subcommands">
<DD><A HREF="entry.htm#M50" NAME="L556"><I>pathName </I><B>scan mark </B><I>x</I></A>
<DD><A HREF="entry.htm#M51" NAME="L557"><I>pathName </I><B>scan dragto </B><I>x</I></A>
</DL>
<DD><A HREF="entry.htm#M52" NAME="L558"><I>pathName </I><B>selection </B><I>option arg</I></A>
<DL class="subcommands">
<DD><A HREF="entry.htm#M53" NAME="L559"><I>pathName </I><B>selection adjust </B><I>index</I></A>
<DD><A HREF="entry.htm#M54" NAME="L560"><I>pathName </I><B>selection clear</B></A>
<DD><A HREF="entry.htm#M55" NAME="L561"><I>pathName </I><B>selection from </B><I>index</I></A>
<DD><A HREF="entry.htm#M56" NAME="L562"><I>pathName </I><B>selection present</B></A>
<DD><A HREF="entry.htm#M57" NAME="L563"><I>pathName </I><B>selection range </B><I>start</I> <I>end</I></A>
<DD><A HREF="entry.htm#M58" NAME="L564"><I>pathName </I><B>selection to </B><I>index</I></A>
</DL>
<DD><A HREF="entry.htm#M59" NAME="L565"><I>pathName </I><B>validate</B></A>
<DD><A HREF="entry.htm#M60" NAME="L566"><I>pathName </I><B>xview </B><I>args</I></A>
<DL class="subcommands">
<DD><A HREF="entry.htm#M61" NAME="L567"><I>pathName </I><B>xview</B></A>
<DD><A HREF="entry.htm#M62" NAME="L568"><I>pathName </I><B>xview</B> <I>index</I></A>
<DD><A HREF="entry.htm#M63" NAME="L569"><I>pathName </I><B>xview moveto</B><I> fraction</I></A>
<DD><A HREF="entry.htm#M64" NAME="L570"><I>pathName </I><B>xview scroll </B><I>number what</I></A>
</DL>
</DL>
<DD><A HREF="entry.htm#M65" NAME="L571">DEFAULT BINDINGS</A>
<OL class="default bindings">
</OL>
<DD><A HREF="entry.htm#M66" NAME="L572">SEE ALSO</A>
<DD><A HREF="entry.htm#M67" NAME="L573">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
entry &mdash; Create and manipulate 'entry' one-line text entry widgets
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>entry</B> <I>pathName </I>?<I>options</I>?<BR>
<H3><A NAME="M4">STANDARD OPTIONS</A></H3>
<DL>
<DT><B><A HREF="options.htm#M-background">-background or -bg, background, Background</A></B>
<DT><B><A HREF="options.htm#M-borderwidth">-borderwidth or -bd, borderWidth, BorderWidth</A></B>
<DT><B><A HREF="options.htm#M-cursor">-cursor, cursor, Cursor</A></B>
<DT><B><A HREF="options.htm#M-exportselection">-exportselection, exportSelection, ExportSelection</A></B>
<DT><B><A HREF="options.htm#M-font">-font, font, Font</A></B>
<DT><B><A HREF="options.htm#M-foreground">-foreground or -fg, foreground, Foreground</A></B>
<DT><B><A HREF="options.htm#M-highlightbackground">-highlightbackground, highlightBackground, HighlightBackground</A></B>
<DT><B><A HREF="options.htm#M-highlightcolor">-highlightcolor, highlightColor, HighlightColor</A></B>
<DT><B><A HREF="options.htm#M-highlightthickness">-highlightthickness, highlightThickness, HighlightThickness</A></B>
<DT><B><A HREF="options.htm#M-insertbackground">-insertbackground, insertBackground, Foreground</A></B>
<DT><B><A HREF="options.htm#M-insertborderwidth">-insertborderwidth, insertBorderWidth, BorderWidth</A></B>
<DT><B><A HREF="options.htm#M-insertofftime">-insertofftime, insertOffTime, OffTime</A></B>
<DT><B><A HREF="options.htm#M-insertontime">-insertontime, insertOnTime, OnTime</A></B>
<DT><B><A HREF="options.htm#M-insertwidth">-insertwidth, insertWidth, InsertWidth</A></B>
<DT><B><A HREF="options.htm#M-justify">-justify, justify, Justify</A></B>
<DT><B><A HREF="options.htm#M-relief">-relief, relief, Relief</A></B>
<DT><B><A HREF="options.htm#M-selectbackground">-selectbackground, selectBackground, Foreground</A></B>
<DT><B><A HREF="options.htm#M-selectborderwidth">-selectborderwidth, selectBorderWidth, BorderWidth</A></B>
<DT><B><A HREF="options.htm#M-selectforeground">-selectforeground, selectForeground, Background</A></B>
<DT><B><A HREF="options.htm#M-takefocus">-takefocus, takeFocus, TakeFocus</A></B>
<DT><B><A HREF="options.htm#M-textvariable">-textvariable, textVariable, Variable</A></B>
<DT><B><A HREF="options.htm#M-xscrollcommand">-xscrollcommand, xScrollCommand, ScrollCommand</A></B>
</DL>
<H3><A NAME="M5">WIDGET-SPECIFIC OPTIONS</A></H3>
<DL>
<DT>Command-Line Name: <B><A NAME="M6">-disabledbackground</A></B>
<DT>Database Name: <B>disabledBackground</B>
<DT>Database Class: <B>DisabledBackground</B>
<DD>Specifies the background color to use when the entry is disabled.  If
this option is the empty string, the normal background color is used.
<P><DT>Command-Line Name: <B><A NAME="M7">-disabledforeground</A></B>
<DT>Database Name: <B>disabledForeground</B>
<DT>Database Class: <B>DisabledForeground</B>
<DD>Specifies the foreground color to use when the entry is disabled.  If
this option is the empty string, the normal foreground color is used.
<P><DT>Command-Line Name: <B><A NAME="M8">-invalidcommand or -invcmd</A></B>
<DT>Database Name: <B>invalidCommand</B>
<DT>Database Class: <B>InvalidCommand</B>
<DD>Specifies a script to eval when <B>-validatecommand</B> returns 0.
Setting it to {} disables this feature (the default).  The best use
of this option is to set it to <I>bell</I>.  See <B><A HREF="#M16">VALIDATION</A></B>
below for more information.
<P><DT>Command-Line Name: <B><A NAME="M9">-readonlybackground</A></B>
<DT>Database Name: <B>readonlyBackground</B>
<DT>Database Class: <B>ReadonlyBackground</B>
<DD>Specifies the background color to use when the entry is readonly.  If
this option is the empty string, the normal background color is used.
<P><DT>Command-Line Name: <B><A NAME="M10">-show</A></B>
<DT>Database Name: <B>show</B>
<DT>Database Class: <B>Show</B>
<DD>If this option is specified, then the true contents of the entry
are not displayed in the window.
Instead, each character in the entry's value will be displayed as
the first character in the value of this option, such as
&ldquo;*&rdquo;.
This is useful, for example, if the entry is to be used to enter
a password.
If characters in the entry are selected and copied elsewhere, the
information copied will be what is displayed, not the true contents
of the entry.
<P><DT>Command-Line Name: <B><A NAME="M11">-state</A></B>
<DT>Database Name: <B>state</B>
<DT>Database Class: <B>State</B>
<DD>Specifies one of three states for the entry:  <B>normal</B>,
<B>disabled</B>, or <B>readonly</B>.  If the entry is readonly, then the
value may not be changed using widget commands and no insertion cursor
will be displayed, even if the input focus is in the widget; the
contents of the widget may still be selected.  If the entry is
disabled, the value may not be changed, no insertion cursor will be
displayed, the contents will not be selectable, and the entry may
be displayed in a different color, depending on the values of the
<B>-disabledforeground</B> and <B>-disabledbackground</B> options.
<P><DT>Command-Line Name: <B><A NAME="M12">-validate</A></B>
<DT>Database Name: <B>validate</B>
<DT>Database Class: <B>Validate</B>
<DD>Specifies the mode in which validation should operate: <B>none</B>,
<B><A HREF="../TkCmd/focus.htm">focus</A></B>, <B>focusin</B>, <B>focusout</B>, <B>key</B>, or <B>all</B>.
It defaults to <B>none</B>.  When you want validation, you must explicitly
state which mode you wish to use.  See <B><A HREF="#M16">VALIDATION</A></B> below for more.
<P><DT>Command-Line Name: <B><A NAME="M13">-validatecommand or -vcmd</A></B>
<DT>Database Name: <B>validateCommand</B>
<DT>Database Class: <B>ValidateCommand</B>
<DD>Specifies a script to eval when you want to validate the input into
the entry widget.  Setting it to {} disables this feature (the default).
This command must return a valid Tcl boolean value.  If it returns 0 (or
the valid Tcl boolean equivalent) then it means you reject the new edition
and it will not occur and the <B>-invalidcommand</B> will be evaluated if it
is set. If it returns 1, then the new edition occurs.
See <B><A HREF="#M16">VALIDATION</A></B> below for more information.
<P><DT>Command-Line Name: <B><A NAME="M14">-width</A></B>
<DT>Database Name: <B>width</B>
<DT>Database Class: <B>Width</B>
<DD>Specifies an integer value indicating the desired width of the entry window,
in average-size characters of the widget's font.
If the value is less than or equal to zero, the widget picks a
size just large enough to hold its current text.
</DL>
<H3><A NAME="M15">DESCRIPTION</A></H3>
The <B>entry</B> command creates a new window (given by the
<I>pathName</I> argument) and makes it into an entry widget.
Additional options, described above, may be specified on the
command line or in the option database
to configure aspects of the entry such as its colors, font,
and relief.  The <B>entry</B> command returns its
<I>pathName</I> argument.  At the time this command is invoked,
there must not exist a window named <I>pathName</I>, but
<I>pathName</I>'s parent must exist.
<P>
An entry is a widget that displays a one-line text string and
allows that string to be edited using widget commands described below, which
are typically bound to keystrokes and mouse actions.
When first created, an entry's string is empty.
A portion of the entry may be selected as described below.
If an entry is exporting its selection (see the <B>-exportselection</B>
option), then it will observe the standard X11 protocols for handling the
selection;  entry selections are available as type <B>STRING</B>.
Entries also observe the standard Tk rules for dealing with the
input focus.  When an entry has the input focus it displays an
<I>insertion cursor</I> to indicate where new characters will be
inserted.
<P>
Entries are capable of displaying strings that are too long to
fit entirely within the widget's window.  In this case, only a
portion of the string will be displayed;  commands described below
may be used to change the view in the window.  Entries use
the standard <B>-xscrollcommand</B> mechanism for interacting with
scrollbars (see the description of the <B>-xscrollcommand</B> option
for details).  They also support scanning, as described below.
<H3><A NAME="M16">VALIDATION</A></H3>
Validation works by setting the <B>-validatecommand</B> option to a
script (<I>validateCommand</I>) which will be evaluated according to
the <B>-validate</B> option as follows:
<P>
<P>
<DL class="validation">
<DT><A NAME="M17"><B>none</B></A><DD>
Default.  This means no validation will occur.
<P><DT><A NAME="M18"><B>focus</B></A><DD>
<I>validateCommand</I> will be called when the entry receives or
loses focus.
<P><DT><A NAME="M19"><B>focusin</B></A><DD>
<I>validateCommand</I> will be called when the entry receives focus.
<P><DT><A NAME="M20"><B>focusout</B></A><DD>
<I>validateCommand</I> will be called when the entry loses focus.
<P><DT><A NAME="M21"><B>key</B></A><DD>
<I>validateCommand</I> will be called when the entry is edited.
<P><DT><A NAME="M22"><B>all</B></A><DD>
<I>validateCommand</I> will be called for all above conditions.
<P></DL>
<P>
It is possible to perform percent substitutions on the value of the
<B>-validatecommand</B> and <B>-invalidcommand</B> options,
just as you would in a <B><A HREF="../TkCmd/bind.htm">bind</A></B> script.  The following substitutions
are recognized:
<P>
<P>
<DL class="validation">
<DT><A NAME="M23"><B>%d</B></A><DD>
Type of action: 1 for <B>insert</B>, 0 for <B>delete</B>,
or -1 for focus, forced or textvariable validation.
<P><DT><A NAME="M24"><B>%i</B></A><DD>
Index of char string to be inserted/deleted, if any, otherwise -1.
<P><DT><A NAME="M25"><B>%P</B></A><DD>
The value of the entry if the edit is allowed.  If you are configuring the
entry widget to have a new textvariable, this will be the value of that
textvariable.
<P><DT><A NAME="M26"><B>%s</B></A><DD>
The current value of entry prior to editing.
<P><DT><A NAME="M27"><B>%S</B></A><DD>
The text string being inserted/deleted, if any, {} otherwise.
<P><DT><A NAME="M28"><B>%v</B></A><DD>
The type of validation currently set.
<P><DT><A NAME="M29"><B>%V</B></A><DD>
The type of validation that triggered the callback
(key, focusin, focusout, forced).
<P><DT><A NAME="M30"><B>%W</B></A><DD>
The name of the entry widget.
<P></DL>
<P>
In general, the <B>-textvariable</B> and <B>-validatecommand</B> options can be
dangerous to mix.  Any problems have been overcome so that using the
<B>-validatecommand</B> will not interfere with the traditional behavior of
the entry widget.  Using the <B>-textvariable</B> for read-only purposes will
never cause problems.  The danger comes when you try set the
<B>-textvariable</B> to something that the <B>-validatecommand</B> would not
accept, which causes <B>-validate</B> to become <I>none</I> (the
<B>-invalidcommand</B> will not be triggered).  The same happens
when an error occurs evaluating the <B>-validatecommand</B>.
<P>
Primarily, an error will occur when the <B>-validatecommand</B> or
<B>-invalidcommand</B> encounters an error in its script while evaluating or
<B>-validatecommand</B> does not return a valid Tcl boolean value.  The
<B>-validate</B> option will also set itself to <B>none</B> when you edit the
entry widget from within either the <B>-validatecommand</B> or the
<B>-invalidcommand</B>.  Such editions will override the one that was being
validated.  If you wish to edit the entry widget (for example set it to {})
during validation and still have the <B>-validate</B> option set, you should
include the command
<PRE>after idle {%W config -validate %v}</PRE>
in the <B>-validatecommand</B> or <B>-invalidcommand</B> (whichever one you
were editing the entry widget from).  It is also recommended to not set an
associated <B>-textvariable</B> during validation, as that can cause the
entry widget to become out of sync with the <B>-textvariable</B>.
<H3><A NAME="M31">WIDGET COMMAND</A></H3>
The <B>entry</B> command creates a new Tcl command whose
name is <I>pathName</I>.  This command may be used to invoke various
operations on the widget.  It has the following general form:
<PRE><I>pathName subcommand </I>?<I>arg arg ...</I>?</PRE>
<I>Subcommand</I> and the <I>arg</I>s
determine the exact behavior of the command.
<H4><A NAME="M32">INDICES</A></H4>
Many of the widget commands for entries take one or more indices as
arguments.  An index specifies a particular character in the entry's
string, in any of the following ways:
<P>
<DL class="indices">
<DT><A NAME="M33"><I>number</I></A><DD>
Specifies the character as a numerical index, where 0 corresponds
to the first character in the string.
<P><DT><A NAME="M34"><B>anchor</B></A><DD>
Indicates the anchor point for the selection, which is set with the
<B>select from</B> and <B>select adjust</B> widget commands.
<P><DT><A NAME="M35"><B>end</B></A><DD>
Indicates the character just after the last one in the entry's string.
This is equivalent to specifying a numerical index equal to the length
of the entry's string.
<P><DT><A NAME="M36"><B>insert</B></A><DD>
Indicates the character adjacent to and immediately following the
insertion cursor.
<P><DT><A NAME="M37"><B>sel.first</B></A><DD>
Indicates the first character in the selection.  It is an error to
use this form if the selection is not in the entry window.
<P><DT><A NAME="M38"><B>sel.last</B></A><DD>
Indicates the character just after the last one in the selection.
It is an error to use this form if the selection is not in the
entry window.
<P><DT><A NAME="M39"><B>@</B><I>number</I></A><DD>
In this form, <I>number</I> is treated as an x-coordinate in the
entry's window;  the character spanning that x-coordinate is used.
For example,
&ldquo;<B>@0</B>&rdquo;
indicates the left-most character in the window.
<P></DL>
<P>
Abbreviations may be used for any of the forms above, e.g.
&ldquo;<B>e</B>&rdquo;
or
&ldquo;<B>sel.f</B>&rdquo;.
In general, out-of-range indices are automatically rounded to the
nearest legal value.
<H4><A NAME="M40">SUBCOMMANDS</A></H4>
The following commands are possible for entry widgets:
<P>
<DL class="subcommands">
<DT><A NAME="M41"><I>pathName </I><B>bbox </B><I>index</I></A><DD>
Returns a list of four numbers describing the bounding box of the
character given by <I>index</I>.
The first two elements of the list give the x and y coordinates of
the upper-left corner of the screen area covered by the character
(in pixels relative to the widget) and the last two elements give
the width and height of the character, in pixels.
The bounding box may refer to a region outside the visible area
of the window.
<P><DT><A NAME="M42"><I>pathName </I><B>cget</B> <I>option</I></A><DD>
Returns the current value of the configuration option given
by <I>option</I>.
<I>Option</I> may have any of the values accepted by the <B>entry</B>
command.
<P><DT><A NAME="M43"><I>pathName </I><B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>?</A><DD>
Query or modify the configuration options of the widget.
If no <I>option</I> is specified, returns a list describing all of
the available options for <I>pathName</I> (see <B><A HREF="../TkLib/ConfigWidg.htm">Tk_ConfigureInfo</A></B> for
information on the format of this list).  If <I>option</I> is specified
with no <I>value</I>, then the command returns a list describing the
one named option (this list will be identical to the corresponding
sublist of the value returned if no <I>option</I> is specified).  If
one or more <I>option-value</I> pairs are specified, then the command
modifies the given widget option(s) to have the given value(s);  in
this case the command returns an empty string.
<I>Option</I> may have any of the values accepted by the <B>entry</B>
command.
<P><DT><A NAME="M44"><I>pathName </I><B>delete </B><I>first </I>?<I>last</I>?</A><DD>
Delete one or more elements of the entry.
<I>First</I> is the index of the first character to delete, and
<I>last</I> is the index of the character just after the last
one to delete.
If <I>last</I> is not specified it defaults to <I>first</I>+1,
i.e. a single character is deleted.
This command returns an empty string.
<P><DT><A NAME="M45"><I>pathName </I><B>get</B></A><DD>
Returns the entry's string.
<P><DT><A NAME="M46"><I>pathName </I><B>icursor </B><I>index</I></A><DD>
Arrange for the insertion cursor to be displayed just before the character
given by <I>index</I>.  Returns an empty string.
<P><DT><A NAME="M47"><I>pathName </I><B>index</B><I> index</I></A><DD>
Returns the numerical index corresponding to <I>index</I>.
<P><DT><A NAME="M48"><I>pathName </I><B>insert </B><I>index string</I></A><DD>
Insert the characters of <I>string</I> just before the character
indicated by <I>index</I>.  Returns an empty string.
<P><DT><A NAME="M49"><I>pathName </I><B>scan</B> <I>option args</I></A><DD>
This command is used to implement scanning on entries.  It has
two forms, depending on <I>option</I>:
<P>
<DL class="subcommands">
<DT><A NAME="M50"><I>pathName </I><B>scan mark </B><I>x</I></A><DD>
Records <I>x</I> and the current view in the entry window;  used in
conjunction with later <B>scan dragto</B> commands.  Typically this
command is associated with a mouse button press in the widget.  It
returns an empty string.
<P><DT><A NAME="M51"><I>pathName </I><B>scan dragto </B><I>x</I></A><DD>
This command computes the difference between its <I>x</I> argument
and the <I>x</I> argument to the last <B>scan mark</B> command for
the widget.  It then adjusts the view left or right by 10 times the
difference in x-coordinates.  This command is typically associated
with mouse motion events in the widget, to produce the effect of
dragging the entry at high speed through the window.  The return
value is an empty string.
<P></DL>
<P><DT><A NAME="M52"><I>pathName </I><B>selection </B><I>option arg</I></A><DD>
This command is used to adjust the selection within an entry.  It
has several forms, depending on <I>option</I>:
<P>
<DL class="subcommands">
<DT><A NAME="M53"><I>pathName </I><B>selection adjust </B><I>index</I></A><DD>
Locate the end of the selection nearest to the character given by
<I>index</I>, and adjust that end of the selection to be at <I>index</I>
(i.e. including but not going beyond <I>index</I>).  The other
end of the selection is made the anchor point for future
<B>select to</B> commands.  If the selection
is not currently in the entry, then a new selection is created to
include the characters between <I>index</I> and the most recent
selection anchor point, inclusive.
Returns an empty string.
<P><DT><A NAME="M54"><I>pathName </I><B>selection clear</B></A><DD>
Clear the selection if it is currently in this widget.  If the
selection is not in this widget then the command has no effect.
Returns an empty string.
<P><DT><A NAME="M55"><I>pathName </I><B>selection from </B><I>index</I></A><DD>
Set the selection anchor point to just before the character
given by <I>index</I>.  Does not change the selection.
Returns an empty string.
<P><DT><A NAME="M56"><I>pathName </I><B>selection present</B></A><DD>
Returns 1 if there is are characters selected in the entry,
0 if nothing is selected.
<P><DT><A NAME="M57"><I>pathName </I><B>selection range </B><I>start</I> <I>end</I></A><DD>
Sets the selection to include the characters starting with
the one indexed by <I>start</I> and ending with the one just
before <I>end</I>.
If <I>end</I> refers to the same character as <I>start</I> or an
earlier one, then the entry's selection is cleared.
<P><DT><A NAME="M58"><I>pathName </I><B>selection to </B><I>index</I></A><DD>
If <I>index</I> is before the anchor point, set the selection
to the characters from <I>index</I> up to but not including
the anchor point.
If <I>index</I> is the same as the anchor point, do nothing.
If <I>index</I> is after the anchor point, set the selection
to the characters from the anchor point up to but not including
<I>index</I>.
The anchor point is determined by the most recent <B>select from</B>
or <B>select adjust</B> command in this widget.
If the selection is not in this widget then a new selection is
created using the most recent anchor point specified for the widget.
Returns an empty string.
<P></DL>
<P><DT><A NAME="M59"><I>pathName </I><B>validate</B></A><DD>
This command is used to force an evaluation of the <B>-validatecommand</B>
independent of the conditions specified by the <B>-validate</B> option.
This is done by temporarily setting the <B>-validate</B> option to <B>all</B>.
It returns 0 or 1.
<P><DT><A NAME="M60"><I>pathName </I><B>xview </B><I>args</I></A><DD>
This command is used to query and change the horizontal position of the
text in the widget's window.  It can take any of the following
forms:
<P>
<DL class="subcommands">
<DT><A NAME="M61"><I>pathName </I><B>xview</B></A><DD>
Returns a list containing two elements.
Each element is a real fraction between 0 and 1;  together they describe
the horizontal span that is visible in the window.
For example, if the first element is .2 and the second element is .6,
20% of the entry's text is off-screen to the left, the middle 40% is visible
in the window, and 40% of the text is off-screen to the right.
These are the same values passed to scrollbars via the <B>-xscrollcommand</B>
option.
<P><DT><A NAME="M62"><I>pathName </I><B>xview</B> <I>index</I></A><DD>
Adjusts the view in the window so that the character given by <I>index</I>
is displayed at the left edge of the window.
<P><DT><A NAME="M63"><I>pathName </I><B>xview moveto</B><I> fraction</I></A><DD>
Adjusts the view in the window so that the character <I>fraction</I> of the
way through the text appears at the left edge of the window.
<I>Fraction</I> must be a fraction between 0 and 1.
<P><DT><A NAME="M64"><I>pathName </I><B>xview scroll </B><I>number what</I></A><DD>
This command shifts the view in the window left or right according to
<I>number</I> and <I>what</I>.
<I>Number</I> must be an integer.
<I>What</I> must be either <B>units</B> or <B>pages</B> or an abbreviation
of one of these.
If <I>what</I> is <B>units</B>, the view adjusts left or right by
<I>number</I> average-width characters on the display;  if it is
<B>pages</B> then the view adjusts by <I>number</I> screenfuls.
If <I>number</I> is negative then characters farther to the left
become visible;  if it is positive then characters farther to the right
become visible.
<P></DL>
<P></DL>
<H3><A NAME="M65">DEFAULT BINDINGS</A></H3>
Tk automatically creates class bindings for entries that give them
the following default behavior. In the descriptions below,
&ldquo;word&rdquo;
refers to a contiguous group of letters, digits, or
&ldquo;_&rdquo;
characters, or any single character other than these.
<P>
<OL class="default bindings">
<LI value="1">
Clicking mouse button 1 positions the insertion cursor
just before the character underneath the mouse cursor, sets the
input focus to this widget, and clears any selection in the widget.
Dragging with mouse button 1 strokes out a selection between
the insertion cursor and the character under the mouse.
<P><LI value="2">
Double-clicking with mouse button 1 selects the word under the mouse
and positions the insertion cursor at the end of the word.
Dragging after a double click will stroke out a selection consisting
of whole words.
<P><LI value="3">
Triple-clicking with mouse button 1 selects all of the text in the
entry and positions the insertion cursor at the end of the line.
<P><LI value="4">
The ends of the selection can be adjusted by dragging with mouse
button 1 while the Shift key is down;  this will adjust the end
of the selection that was nearest to the mouse cursor when button
1 was pressed.
If the button is double-clicked before dragging then the selection
will be adjusted in units of whole words.
<P><LI value="5">
Clicking mouse button 1 with the Control key down will position the
insertion cursor in the entry without affecting the selection.
<P><LI value="6">
If any normal printing characters are typed in an entry, they are
inserted at the point of the insertion cursor.
<P><LI value="7">
The view in the entry can be adjusted by dragging with the middle
mouse button (button 2, or button 3 in TkAqua). If the middle mouse
button is clicked without moving the mouse, the selection is copied
into the entry at the position of the mouse cursor.
<P><LI value="8">
If the mouse is dragged out of the entry on the left or right sides
while button 1 is pressed, the entry will automatically scroll to
make more text visible (if there is more text off-screen on the side
where the mouse left the window).
<P><LI value="9">
The Left and Right keys move the insertion cursor one character to the
left or right;  they also clear any selection in the entry and set
the selection anchor.
If Left or Right is typed with the Shift key down, then the insertion
cursor moves and the selection is extended to include the new character.
Control-Left and Control-Right move the insertion cursor by words, and
Control-Shift-Left and Control-Shift-Right move the insertion cursor
by words and also extend the selection.
Control-b and Control-f behave the same as Left and Right, respectively.
Meta-b and Meta-f behave the same as Control-Left and Control-Right,
respectively.
<P><LI value="10">
The Home key, or Control-a, will move the insertion cursor to the
beginning of the entry and clear any selection in the entry.
Shift-Home moves the insertion cursor to the beginning of the entry
and also extends the selection to that point.
<P><LI value="11">
The End key, or Control-e, will move the insertion cursor to the
end of the entry and clear any selection in the entry.
Shift-End moves the cursor to the end and extends the selection
to that point.
<P><LI value="12">
The Select key and Control-Space set the selection anchor to the position
of the insertion cursor.  They do not affect the current selection.
Shift-Select and Control-Shift-Space adjust the selection to the
current position of the insertion cursor, selecting from the anchor
to the insertion cursor if there was not any selection previously.
<P><LI value="13">
Control-/ selects all the text in the entry.
<P><LI value="14">
Control-&#92; clears any selection in the entry.
<P><LI value="15">
The F16 key (labelled Copy on many Sun workstations) or Meta-w
copies the selection in the widget to the clipboard, if there is a selection.
<P><LI value="16">
The F20 key (labelled Cut on many Sun workstations) or Control-w
copies the selection in the widget to the clipboard and deletes
the selection.
If there is no selection in the widget then these keys have no effect.
<P><LI value="17">
The F18 key (labelled Paste on many Sun workstations) or Control-y
inserts the contents of the clipboard at the position of the
insertion cursor.
<P><LI value="18">
The Delete key deletes the selection, if there is one in the entry.
If there is no selection, it deletes the character to the right of
the insertion cursor.
<P><LI value="19">
The BackSpace key and Control-h delete the selection, if there is one
in the entry.
If there is no selection, it deletes the character to the left of
the insertion cursor.
<P><LI value="20">
Control-d deletes the character to the right of the insertion cursor.
<P><LI value="21">
Meta-d deletes the word to the right of the insertion cursor.
<P><LI value="22">
Control-k deletes all the characters to the right of the insertion
cursor.
<P><LI value="23">
Control-t reverses the order of the two characters to the right of
the insertion cursor.
<P></OL>
<P>
If the entry is disabled using the <B>-state</B> option, then the entry's
view can still be adjusted and text in the entry can still be selected,
but no insertion cursor will be displayed and no text modifications will
take place
except if the entry is linked to a variable using the <B>-textvariable</B>
option, in which case any changes to the variable are reflected by the
entry whatever the value of its <B>-state</B> option.
<P>
The behavior of entries can be changed by defining new bindings for
individual widgets or by redefining the class bindings.
<H3><A NAME="M66">SEE ALSO</A></H3>
<B><A HREF="../TkCmd/ttk_entry.htm">ttk::entry</A></B>
<H3><A NAME="M67">KEYWORDS</A></H3>
<A href="../Keywords/E.htm#entry">entry</A>, <A href="../Keywords/W.htm#widget">widget</A>
<div class="copy">Copyright &copy; 1990-1994 The Regents of the University of California.
<BR>Copyright &copy; 1994-1996 Sun Microsystems, Inc.
<BR>Copyright &copy; 1998-2000 Scriptics Corporation.
</div>
</BODY></HTML>
